﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Kokomo.Mirror.CliMetadata
{
	class CliSyntheticMethodInfo : CliMethodInfoBase
	{
		internal CliSyntheticMethodInfo(
			CliMemberBasicInfo basicInfo,
			string name,
			CliParameterInfo[] parameters,
			CliParameterInfo returnParameter,
			MethodAttributes attributes,
			MethodImplAttributes implAttributes
			)
			: base(basicInfo, name)
		{
			this._parameters = parameters;
			this._returnParameter = returnParameter;
			this._attributes = attributes;
			this._implAttributes = implAttributes;

			foreach (var parameter in parameters)
			{
				parameter.owner = this;
			}
			if (returnParameter != null)
				returnParameter.owner = this;
		}

		public override int MetadataToken
		{
			get
			{
				return 0;
			}
		}

		private MethodAttributes _attributes;
		public override MethodAttributes Attributes
		{
			get { return this._attributes; }
		}

		private MethodImplAttributes _implAttributes;
		public override MethodImplAttributes GetMethodImplementationFlags()
		{
			return this._implAttributes;
		}

		private CliParameterInfo _returnParameter;
		protected override ParameterInfo[] LoadParameters(out ParameterInfo returnParameter)
		{
			returnParameter = this._returnParameter;
			return this._parameters;
		}
		private ParameterInfo[] _parameters;
	}
}
